/*
 *  $Id: PoisonousCloud.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Darkness.Spells {
    public class PoisonousCloud: SelfEnchantmentCard {
        public PoisonousCloud(): base("001_d_s_poisonous_cloud") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Darkness;
            Value = 100;
            AddManaCost(ElementType.Darkness, 4);
        }

        protected override EnchantmentAffect CreateEnchantment() {
            return new PoisonousCloudAffect();
        }

        private class PoisonousCloudAffect: EnchantmentAffect<PoisonousCloud> {
            public override void SetAffect() {
                base.SetAffect();
                GlobalSummary.OnStartOffencePhase += DoPoisonousCloud;
            }
            public override void ResetAffect() {
                base.ResetAffect();
                GlobalSummary.OnStartOffencePhase -= DoPoisonousCloud;
            }

            private void DoPoisonousCloud() {
                foreach (Creature creature in Owner.Owner.Enemy.GetCreatures())
                    creature.DamageBy(NewDamage(DamageType.Darkness, 1));
            }
        }
    }
}
